%Beta Kalman estimation
function [betaKalman] = BetaKalman(rStock, rIndex, process)

%process = 1 (Coefficent model)
%process = 2 (Walk model)
%Maximize the Kalman likelihood function to estimate the parameters
%Phi, bar_b, alpha, b0, big_sigma0, sigma_square_n, sigma_square_epsilon
params = KFRunOpt(rStock, rIndex, process);

%kalman Filter Process
[outkalman] = BetaKalmanEstimate(params, process, rStock, rIndex);
betaKalman = outkalman(:,8);
end